package com.androidx.p013lv.base.glide.decrypt;

import android.content.Context;
import android.os.Environment;
import com.androidx.p013lv.base.BaseSdk;
import com.androidx.p013lv.base.glide.decrypt.OkHttpUrlLoader;
import com.androidx.p013lv.base.glide.decrypt.UrlLoader;
import com.bumptech.glide.Glide;
import com.bumptech.glide.GlideBuilder;
import com.bumptech.glide.Registry;
import com.bumptech.glide.load.engine.cache.DiskLruCacheFactory;
import com.bumptech.glide.load.engine.cache.ExternalCacheDiskCacheFactory;
import com.bumptech.glide.load.engine.cache.LruResourceCache;
import com.bumptech.glide.load.model.GlideUrl;
import com.bumptech.glide.module.AppGlideModule;
import java.io.InputStream;
import java.net.URL;

/* renamed from: com.androidx.lv.base.glide.decrypt.GlideAppMoudle */
public class GlideAppMoudle extends AppGlideModule {
    public static final String IMAGE_CAHE_FOLDER = "pddff/cache/imgCache";

    @Override // com.bumptech.glide.module.AppGlideModule
    public boolean isManifestParsingEnabled() {
        return false;
    }

    @Override // com.bumptech.glide.module.AppliesOptions, com.bumptech.glide.module.AppGlideModule
    public void applyOptions(Context context, GlideBuilder glideBuilder) {
        glideBuilder.setMemoryCache(new LruResourceCache((long) 25165824));
        glideBuilder.setDiskCache(new ExternalCacheDiskCacheFactory(context, IMAGE_CAHE_FOLDER, 524288000));
        if ("mounted".equals(Environment.getExternalStorageState())) {
            glideBuilder.setDiskCache(new DiskLruCacheFactory(Environment.getExternalStorageDirectory().getAbsolutePath() + "/" + IMAGE_CAHE_FOLDER, (long) 524288000));
            return;
        }
        glideBuilder.setDiskCache(new ExternalCacheDiskCacheFactory(context, IMAGE_CAHE_FOLDER, 524288000));
    }

    @Override // com.bumptech.glide.module.RegistersComponents, com.bumptech.glide.module.LibraryGlideModule
    public void registerComponents(Context context, Glide glide, Registry registry) {
        registry.replace(URL.class, InputStream.class, new UrlLoader.StreamFactory());
        registry.replace(GlideUrl.class, InputStream.class, new OkHttpUrlLoader.Factory(BaseSdk.getOkHttpClient()));
    }
}
